import {Toast} from "@ionic-native/toast";
/**
 * Created by ZQH on 2018/1/5.
 * ionic cordova plugin add cordova-plugin-x-toast
 * npm install --save @ionic-native/toast
 * 1.在使用该工具类时先通过以上命令安装Toast插件,
 * 2.在app.module.ts中的写入
 *import {Toast} from "@ionic-native/toast";
 * 在providers中引入Toast
 * 最后在AppModule的构造函数中初始化 ZQHNFC.toast = this.toast;
 */

export class ZQHToast {

  public static toast: Toast;

  constructor() {

  }

  public static show(message, duration, position) {
    this.toast.show(message, duration, position).subscribe(
      toast => {
        console.log(toast);
      }
    );
  }

  public static showShortTop(message) {
    this.toast.showShortTop(message);
  }

  public static showShortCenter(message) {
    this.toast.showShortCenter(message).subscribe(
      toast => {
        console.log(toast);
      }
    );
  }

  public static showLongTop(message) {
    this.toast.showLongTop(message).subscribe(
      toast => {
        console.log(toast);
      }
    );
  }

  public static showLongCenter(message) {
    this.toast.showLongCenter(message).subscribe(
      toast => {
        console.log(toast);
      }
    );
  }

  public static showLongBottom(message) {
    this.toast.showLongBottom(message).subscribe(
      toast => {
        console.log(toast);
      }
    );
  }
}
